package com.qumitech.visualnovel.service.basic.impl;

import com.qumitech.visualnovel.controller.vo.basic.BasicStatisticsDataVO;
import com.qumitech.visualnovel.controller.vo.basic.RegisterChannelBasicStatisticsDataVO;
import com.qumitech.visualnovel.controller.vo.basic.StartChannelBasicStatisticsDataVO;
import com.qumitech.visualnovel.datasource.console.BasicStatisticsDataMapper;
import com.qumitech.visualnovel.datasource.console.RegisterChannelBasicDataMapper;
import com.qumitech.visualnovel.datasource.console.StartChannelBasicDataMapper;
import com.qumitech.visualnovel.model.dao.console.BasicStatisticsData;
import com.qumitech.visualnovel.model.dao.console.StartChannelBasicData;
import com.qumitech.visualnovel.service.basic.RegisterChannelBasicStatisticsDataService;
import com.qumitech.visualnovel.service.basic.StartChannelBasicStatisticsDataService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author :  ZhChNing
 * @Descriptiom :
 * @Date Created in 2019/3/12 16:19
 */

@Service
public class RegisterChannelBasicStatisticsDataServiceImpl implements RegisterChannelBasicStatisticsDataService {

    @Autowired
    RegisterChannelBasicDataMapper registerChannelBasicDataMapper;


    @Override
    public List<RegisterChannelBasicStatisticsDataVO> listBasicStatisticsData(String appChannel, String startTime, String endTime, Integer offset, Integer limit) {
        List<RegisterChannelBasicStatisticsDataVO> registerChannelBasicDataList = registerChannelBasicDataMapper.listBasicStatisticsData(appChannel, startTime, endTime, offset, limit);
        for(RegisterChannelBasicStatisticsDataVO registerChannelBasicData: registerChannelBasicDataList){
            registerChannelBasicData.calculateActivePayRate();
            registerChannelBasicData.calculateNewRegisterRate();
        }
        return registerChannelBasicDataList;
    }

    @Override
    public Integer getCount(String appChannel, String startTime, String endTime, Integer offset, Integer limit) {
        return registerChannelBasicDataMapper.getCount(appChannel,startTime,endTime,offset,limit);
    }

}
